package org.gpp.proj1.logic.core.board;

public class RobotPosition implements Comparable {
	
	private FacingSides facing;
	
	private int x;
	
	private int y;
	
	public RobotPosition( FacingSides facing, int x, int y ) {

		this.facing = facing;
		this.x = x;
		this.y = y;
	}

	public FacingSides getFacing() {
		return facing;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}
	
	@Override
	public String toString() {
		
		return "[" + x + "," + y + "] facing " + facing;
	}

	public void setX(int x) {
		
		this.x = x;
	}
	
	public void setY(int y) {
		
		this.y = y;
	}

	public int compareTo(Object o) {
		
		RobotPosition other = (RobotPosition) o;		
		return (x == other.x && y == other.y && facing.equals( other.facing )) ? 0 : -1;
	}
	
	public boolean equals(Object o) {
		
		RobotPosition other = (RobotPosition) o;		
		return (x == other.x && y == other.y && facing.equals( other.facing ));
	}
	
	public int hashCode() {
		
		return (x + ":" + y + ":" + facing).hashCode();
	}
}
